#ifndef TIMEAXIS_H
#define TIMEAXIS_H

#include <QList>

#include "pcchild.h"


class TimeAxis : public PCChild
{
public:

    struct Grad {
        float time;
        int pos;
    };

    TimeAxis(ProCycle *app);


    float unit2px() {
        return m_scale;
    }

    float unit2px (float units) {
        return units * m_scale;
    }

    float px2unit() {
        return 1 / m_scale;
    }

    float px2unit (float pxs) {
        return pxs / m_scale;
    }



    int length () const {
        return m_length;
    }

    void setLength(const int& length);

    double scale() const {
        return m_scale;
    }

    void setScale(const double& scale);


    void updateGrads();


    QList<Grad>::const_iterator begin() const {
        return m_grads.begin();
    }
    QList<Grad>::const_iterator end() const {
        return m_grads.end();
    }

    int gradCount() const {
        return m_grads.size();
    }

    const QList<Grad>& grads() const {
        return m_grads;
    }


private:

    int		m_length;
    double	m_scale;

    QList<Grad> m_grads;

    float m_lastScale;
    int m_lastWidth;
};

#endif // TIMEAXIS_H
